function launch() {
    let formData = new FormData($("#lunchExam")[0])
    formData.append('hello', '12')
    formData.set('endTime',formData.get('endTime').replace('T',' '))
    formData.set('startTime',formData.get('startTime').replace('T',' '))
    console.log(formData) 
    $.ajax({
        type: "POST",
        url: "/admin/launchExam/build",
        data: formData,
        async: true,
        contentType: false,
        processData: false,
        success: function (data) {
            console.log(data)
            if (data.err == 0) {
                alert("考试创建成功，请导入考生");
                $("#testNumber").val(data.data.data.testNumber)
            } else {
                alert(data.msg);
            }
        }
    });
}
function download() {
    window.open('/excel/studentList.xls')
}
function upload() {
    $('[type=file]').eq(0).click();
    document.getElementById('ExcelTemplate').onchange = function () {

        var excel = document.getElementById('ExcelTemplate').files[0]
        console.log(excel.name.split('.')[1])
        if (excel.name.split('.')[1] == 'xls') {
            if ($("#testNumber").val() != '') {
                document.getElementById('uploadForm').submit()
                alert("上传成功")
                window.location.href = "/admin/goExam"
            } else {
                alert("请先创建考试")
            }
        } else {
            alert('上传模板文件有误，请阅读导入模板注意事项')
        }
    }
}